<html><head>
<title>个人中心</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" type="text/css" href="{$app_path}{$static_path}/css/page.css">
<link rel="stylesheet" type="text/css" href="{$app_path}{$static_path}/css/user-center.css">
<include file="./Public/public/public.html" />
<script>
        $(document).ready(function(){
            //分页大小
            var ps=parseInt($('input[name="ps"]').val());
            $('select[name="ps"]').find('option[value='+ps+']').attr("selected",true);
            $('select[name="ps"]').change(function(){
                $('input[name="ps"]').val($(this).val());
                $('#queryForm').attr('action', "{:U('Mydomain/index')}");
                $('#queryForm').Nsubmit();
            });
            //批量全选
            $("[action=switchChk]").on('change',function(){
                if(this.checked){
                    $('[action="chk"]').prop('checked',true);
                    $('input[id*="payload_"]').prop( "disabled", false );
                }else{
                    $('[action="chk"]').prop('checked',false);
                    $('input[id*="payload_"]').prop( "disabled", true );
                }
            })
            //判断批量全选
            $('[action="chk"]').on('change',function(){
                var length = $('[action="chk"]').filter(':checked').length;
                if(length==$('[action="chk"]').length){
                    $("[action=switchChk]").prop('checked',true);
                }else{
                    $("[action=switchChk]").prop('checked',false);
                }
                if(this.checked){
                    $("input[id$='_" + $(this).attr('data-id') + "']").prop( "disabled", false );
                }else{
                    $("input[id$='_" + $(this).attr('data-id') + "']").prop( "disabled", true );
                }
            });
            //抵押域名
            $("[action='mortgage']").click(function(){
                var _checkedElems = $('[action="chk"]').filter(':checked');
                // 验证是否有选择抵押域名信息
                if(_checkedElems.length <= 0){
                    showModal({msg:"请选择要抵押的域名"}); return;
                }
                // 验证是否选择同一品类
                var _temporary = [];
                _checkedElems.each(function(k,v) {
                    var _categoryId = $(v).attr('data-category');
                    if ($.inArray(_categoryId, _temporary) === -1) {
                        _temporary.push(_categoryId);
                    }
                    // fix go back problem...
                    $("input[id$='_" + $(v).attr('data-id') + "']").prop( "disabled", false );
                });
                if (_temporary.length <= 0 || _temporary.length > 1) {
                    showModal({msg:"品类信息只能单选哦"}); return;
                }
                $('#frm_mortgage').submit();
            });
            //转出域名
            var getRegistrars = function () {
                 $.get("{:U('Mydomain/mybusines')}",{ registrar: ''}, function(result){
                    if (!result) {
                        showModal({
                            msg:"您还没有设置注册商信息，请先设置",
                            callbackTime:3000,
                            end:function(){location.href = "{:U('Regbusiness/index')}";}
                        });
                    } else {
                        var opts = $.map(result, function(v){
                            return $('<option/>', {"value":v.id, "text": v.name+"("+v.busicode+")"});
                        });
                        $("#registrars").empty().append(opts);
                        $("[popup='pull_out']").reveal();
                    }
                }); 
            }
            $("input[action='confirm']").click(function () {
                var _id = $('#domainId').val();
                if (!_id) return;
                var _frm = $('#frm_pullout');
                _frm.Qvalidate({
                    onError:function(element,msg){
                        $(element).addClass("input-error");
                        showModal({ msg:msg });
                    }
                });
                if (_frm.Qvalidate.valid()) {
                    showConfirm({
                        msg: "您确定要转出选中的域名吗?",
                        confirmed: function () {
                        	$.ajax({
                        		url:"{:U('Mydomain/pullout')}",
                        		data:$('#frm_pullout').serialize(),
                        		datatype:'json',
                        		success:function(resp) {
                        			 if (resp.status == '1') { showModal('验证码错误或已过期!'); }
                        			 else if(resp.status=='2'){showModal('交易密码错误!');}
                                     else { showModal('操作成功'); 
                                     $("[popup='pull_out']").closeModal();
                        			 $("[popup='pull_out']").css("display","none");
                                     }
                        		}
                            });
                        }
                    })
                }
            });
            $("a[action='pull_out']").click(function () {
            	getRegistrars();
            	$('#domainId').val($(this).attr("data-id"));
            	$("[popup='pull_out']").css("display","block");
            });

            //批量转出域名
            $("a[action='pull_out_batch']").click(function(){
                var _checkedElems = $('[action="chk"]').filter(':checked');
                // 验证是否有选择转出域名信息
                if(_checkedElems.length <= 0){
                    showModal({msg:"请选择要转出的域名"}); return;
                }
                var _checkedVals = $.map(_checkedElems, function(v) {
                    return $(v).attr('data-registrar');
                });
                if(_checkedElems.length != _checkedVals.length){
                    showModal({msg:"数据不正确"}); return;
                }
                var uniqueRegistrars = [];
                $.each(_checkedVals, function(i, el){
                    if($.inArray(el, uniqueRegistrars) === -1) uniqueRegistrars.push(el);
                });
                if (uniqueRegistrars.length > 1) {
                    showModal({msg:"批量转出不支持同时选择多个域名注册商哦"}); return;
                }
                var checkedIds = $.map(_checkedElems, function(v){
                    return $(v).attr('data-id');
                });
                $('#domainId').val(checkedIds);
                getRegistrars();
                $("[popup='pull_out']").css("display","block");
            });
            //导出域名
           /*  $("#export").click(function () {
                $('#queryForm').attr('action', "/Home/Center/exportDomain.html");
                $('#queryForm').Nsubmit();
            }); */
            $("#query").click(function () {
                $('#queryForm').attr('action', "{:U('Mydomain/index')}");
                $('#queryForm').Nsubmit();
            });
            $("#psselec").change(function(){
            	$("querPsid").val($(this).val());
            });
            $("[action='cancel']").click(function(){
            	$("[popup='pull_out']").css("display","none");
            });
            $("[action='closeModal']").click(function(){
            	$("[popup='pull_out']").css("display","none");
            });
            $("#23_timer5742").click(function(){
        		smsSend("23_timer5742");
        	});
        });
        
        
        /**
         * 发送短信验证码
         */
        var smsSend=function(id){
        	var obj=$("#"+id);
        	$.ajax({
        		type:'get',
        		url:"{:U('Mydomain/sendupdomainSms')}",
        		success:function(data){
        			if(data.code=='error') {
        				showModal(data.info);
        			} else {
        				fun_timedown(id,60);
        				showModal(data.info);
        				$("#"+id).unbind("click");
        			}
        		}
        	});
        };
        /**
         * 倒计时
         */
        function fun_timedown(str,time) {
        	$("#"+str).text(time+"秒");
            time = time-1;
            if(time>=0){
                setTimeout("fun_timedown('"+str+"','"+time+"')",1000);
            }else{
            	if(str=="21_timer1779") {
            		$("#"+str).bind("click", function(){emailSend(str);});
            	} else {
            		$("#"+str).bind("click", function(){smsSend(str);});
            	}
            	$("#"+str).text("发送验证码");
            }
        }
    </script>
</head>
<body>
<include file="./Public/public/top.html" />

<div class="layout-wrap">
    <!--已审核-->
    <div class="layout">
<include file="./Public/public/centerLeft.html" />   

<div popup="pull_out" class="reveal-modal medium" topmeasure="50" topoffset="297" locked="false" 
animation="none" animationspeed="500" closeonbackgroundclick="true" dismissmodalclass="close-reveal-modal"
 dismissjqobject="[action="cancel"]" z-index="1001" switch="close"
  style="z-index: 1001; display: none; top: 50px;">
  <a class="close-reveal-modal" action="closeModal">×</a>
    <h3 id="popupTitle">申请转出域名</h3>
    <div>
    <form method="post" action="{:U('Mydomain/pullout')}" id="frm_pullout">
        <div class="form-row form-row-s mt20">
            <input id="domainId" type="hidden" name="domain_id" value="">
            <div class="input-name w25" id="fieldName">注册商ID</div>
            <div class="input-box w45">
            <select id="registrars" name="registrarId">
            </select>
            </div>
            <div class="input-name-even w30"><a href="{:U('Regbusiness/index')}" target="_blank">管理注册商ID</a></div>
            <div class="clr"></div>
        </div>
        <div class="form-row form-row-s">
            <div class="input-name w25">短信验证码</div>
            <div class="input-box w40">
                <input id="smscode6113" name="smscode_pullOut" type="tel"
                 valid="{required:true,number:true,limitLength:6}" 
                 msg="{required:'请填写6位数字验证码',number:'请填写6位数字验证码',limitLength:'请填写6位数字验证码'}" class="input-s" 
                 placeholder="6位数字验证码">
            </div>
            <div class="input-box w35">
               <div id="23_timer5742" watch="" name="pullOut" method="sms" emsg="请输入正确的手机号"
                		 token="96a679a765e1bb4cbe9a969bbcd0ace4" left="0" class="timer w95 ml5"> 获取验证码 </div>
            </div>
            <div class="clr"></div>
        </div>
        <div class="form-row form-row-s">
            <div class="input-name w25">交易密码</div>
            <div class="input-box w40">
                <input name="authpwd" type="password" valid="{required:true}" msg="{required:'请填写交易密码'}" 
                class="input-s" autocomplete="off"></script>
            </div>
            <div class="input-name-even w30"><a href="{:U('User/pwd')}">设置密码?</a></div>
            <div class="clr"></div>
        </div>
        <div class="split-dot mb20 mt20 text-center"></div>
        <div class="form-row form-row-s">
            <input type="button" action="confirm" class=" button button-blue w45 fl" value="确认">
            <input type="button" action="cancel" class=" button button-gray w45 fr" value="取消">
            <div class="clr"></div>
        </div>
    </form>
  </div>   
</div>
                  
<div class="right" ms-controller="right" style="min-height: 882px;">
        <h3>我的域名
            <div class="sub">
                <span class="field">可交易/抵押域名:<span class="red06">{$zccount}</span>个</span>
                <span class="field">交易中的域名:<span class="red06">{$jycount}</span>个</span>
                <span class="field">抵押中的域名:<span class="red06">{$dycount}</span>个</span>
                <span class="field">兑出中的域名:<span class="red06">{$dhcount}</span>个</span>
            </div>
        </h3>
        <div class="cnt-tips">
            <p>温馨提示：进入续费期（一个月内）的域名不能交易，不能抵押。<br>
            您域名想申请在诚拍拍卖的话，请联系客服微信：162115886<br>
                        </p>
        </div>
        <div class="split-dot mt10 mb10">
        </div>
        <div class="search-wrapper pc-only">
            <form method="post" id="queryForm">
            <input type="hidden" name="ps" value="{$ps}" id="querPsid"/>
                <div class="form-row form-row-s">
                    <div class="input-name-even w10 ">种类</div>
                    <div class="input-box w15 ">
                        <select name="domType"> 
                        <option value="">全部</option>
                        <volist name="domTypes" id="vo">
                        	<option value="{$vo.id}" <if condition="$domType eq $vo.id">selected</if>>{$vo.name}</option>
                        </volist>
						</select> 
                    </div>
                    <div class="input-name-even w10">域名</div>
                    <div class="input-box w15"><input class="input-s" name="domain" value=""></div>
                    <div class="input-name-even w10">注册商</div>
                    <div class="input-box w15">
                        <select name="domain_registrar">
                         <option value="">无</option>
                         <volist name="regblist" id="reg">
                           <option value="{$reg.id}" <if condition="$domain_registrar eq $reg.id">selected</if>>{$reg.name}</option>
                         </volist>
                         </select> 
                    </div>
                    
                    <div class="input-name-even w10 ">到期时间</div>
                    <div class="input-box w15 ">
                        <select name="expiredate"> 
                        <option value="">-无到期时间-</option>
                        <option value="1" <if condition="$expiredate eq 1">selected</if>>1个月</option>
                        <option value="2" <if condition="$expiredate eq 2">selected</if>>2个月</option>
                        <option value="3" <if condition="$expiredate eq 3">selected</if>>3个月</option>
                        <option value="4" <if condition="$expiredate eq 4">selected</if>>3个月以上</option>
                        </select> 
                    </div>
                    
                    <div class="clr"></div>
                </div>
                <div class="form-row form-row-s">
                    <div class="input-name-even w10 ">是否出借</div>
                    <div class="input-box w15 ">
                        <select name="is_loan">
                         <option value="">全部</option>
                         <option value="2" <if condition="$is_loan eq 2">selected</if>>是</option>
                         <option value="1" <if condition="$is_loan eq 1">selected</if>>否</option></select> 
                    </div>
                    <div class="input-name-even w10 ">状态</div>
                    <div class="input-box w15 ">
                        <select name="trans_status"> 
                        <option value="">全部</option>
                        <option value="1" <if condition="$trans_status eq 1">selected</if>>正常</option>
                        <option value="2" <if condition="$trans_status eq 2">selected</if>>委单中</option>
                        <option value="3" <if condition="$trans_status eq 3">selected</if>>申请兑回</option>
                        </select> 
                    </div>
                    <div class="input-name w10"></div>
                    <div class="input-box w15">
                        <a class="button-s button-blue w100" id="query">查询</a>
                    </div>
                    <div class="input-name w10"></div>
                    <!-- <div class="input-box w15">
                        <a class="button-s button-blue w100" title="按指定查询条件导出或导出所有" target="_blank" id="export">导出本次查询(Excel)</a>
                    </div> -->
                    <div class="clr"></div>
                    <input type="hidden" name="ps" value="">
                </div>
            </form>
        </div>
        <div class="pt10 pb10">
            <span style="float: right;" class="mr20">本次查询域名总数：<b class="red06">{$allcount}</b></span>
        </div>
	<br/>
        <div class="table-wrappper">
            <div class="table table-w300">
                <form action="{:U('Mydomain/index')}" method="post" id="frm_mortgage">
                    <div class="th">
                        <div class="td w5"><div class="ml10">
                        </div></div>
                        <div class="td w15"><span class="ml10">域名</span></div>
                        <div class="td w10"><span class="ml10">品种</span></div>
                        <div class="td w10"><span class="ml10">成交价</span></div>
                        <div class="td w10"><span class="ml10">状态</span></div>
                        <div class="td w10"><span class="ml10">抵押中</span></div>
                        <div class="td w10"><span class="ml10">注册商</span></div>
                        <div class="td w10"><span class="ml10">过期日期</span></div>
                        <div class="td w15">

                        </div>
                        <div class="clr"></div>
                    </div>

                    <div class="th-tool-bar">
                        <div class="td w5"><div class="ml10"> 
                        <input type="checkbox" action="switchChk" style="margin:5px 10px -5px 0px">全选</div></div>
                        <div class="td w80">
                            <span class="ml10">
                            <a class="button-xs button-orange" style="margin:10px 0px -5px 0px"
				 action="pull_out_batch">转出选中域名</a>
                            </span>
                        </div>
                        <div class="td w15">

                        </div>
                        <div class="clr"></div>
                    </div>
                    <volist name="domainList" id="vo">
                    <div class="tr domain">
                            <div class="td w5"><div class="ml10 mt5">
                         <input type="checkbox" action="chk" data-id="{$vo.id}" 
                         <if condition="$vo.trans_status neq 1 or $vo.is_mortage eq 2">disabled="true"</if> data-registrar="{$vo.pushid}" data-locked="-1">
                                  </div>
                        </div>
                        <div class="td w15"><div class="ml10">{$vo.domain}</div></div>
                        <div class="td w10"><span class="ml10">{$vo.tyname}</span></div>
                        <div class="td w10"><span class="ml10">{$vo.price}元</span></div>
                        <div class="td w10">
                            <span class="ml10 green06">
                            <if condition="$vo.trans_status eq 1">正常</if>
                            <if condition="$vo.trans_status eq 2">委单中</if>
                            <if condition="$vo.trans_status eq 3">申请兑回</if>
                            </span>
                        </div>
                        <div class="td w10">
                            <span class="ml10 green06">
                            <if condition="$vo.is_mortage eq 1">未抵押</if>
                            <if condition="$vo.is_mortage eq 2">抵押中</if>
                            </span>         
                                  </div>
                        <div class="td w10"><span class="ml10">{$vo.name}</span></div>
                        <div class="td w10"><span class="ml10">{$vo.expriedate}</span></div>
                        <div class="td w10"><span class="ml10">
                        <if condition="$vo.trans_status eq 1 and $vo.is_mortage eq 1">
                        	 <a class="button-blue button-xs mt5 ml10" style="margin:-0px 0px -20px 40px" 
                    action="pull_out" data-id="{$vo.id}" data-registrar="aiming">转出域名</a>
                        </if>
                      </span></div>
                        <div class="clr"></div>
                    </div></volist>
                    <div class="tr">
						<div class="td ">
							<div class="pages"><span>共<font>{$allcount}</font>条记录,当前第{$page}页</span>
							 <if condition="$page eq 1">
							         上一页&nbsp;&nbsp;&nbsp;
							 <else />
							    <a href="{$app_path}/mydomain/index/page/{$page-1}.html">上一页</a>&nbsp;&nbsp;&nbsp;
							 </if>
							 
							  <if condition="$page eq $pageNum">
							         下一页&nbsp;&nbsp;&nbsp;
							 <else />
								<a href="{$app_path}/mydomain/index/page/{$page+1}.html">下一页</a></div>&nbsp;&nbsp;
							 </if>
							 
						</div>
						<div class="clr"></div>
					</div>
                </form>
            </div>
        </div>
        <div class="pt10 pb10">
            <div class="dataTables_paginate paging_full_numbers">
                <div>
                    <div>    </div>                </div>
            </div>
        </div>
    </div>
    
    <div class="clr"></div>
        </div>
        <div class="clr"></div>
    </div>
<div popup="confirm" class="reveal-modal medium" topmeasure="50" topoffset="256" locked="false" animation="none" 
    animationspeed="500" closeonbackgroundclick="true" dismissmodalclass="close-reveal-modal" 
dismissjqobject="[action=&quot;cancel&quot;]" z-index="1001" switch="open" style="z-index: 1002; display: none; top: 650px;">
    <a class="close-reveal-modal" action="closeModal">×</a>
    <div class="confirm-inner">
            <img src="{$app_path}{$static_path}/img/icon_orange_question.png">
            <span action="msg"></span>
    </div>

    <div class="split-dot mb20 text-center"></div>
    <div class="form-row">
        <a action="confirm" class=" button button-orange w40 fl">知道了</a>
        <a action="cancel" class=" button button-gray w40 fr">取消</a>
        <div class="clr"></div>
    </div>
</div><div class="reveal-modal-bg" style="display: none;"></div>
<include file="./Public/public/footer.html" />
<script type="text/javascript">
  $(".selessearch").change(function(){
	  $("#queryForm").submit();
  });
</script>
</body></html>